package cn.wolfcode.p2p.bussness.service.impl;

import cn.wolfcode.p2p.base.query.QueryObject;
import cn.wolfcode.p2p.bussness.domain.ExpAccountGrantRecord;
import cn.wolfcode.p2p.bussness.mapper.ExpAccountGrantRecordMapper;
import cn.wolfcode.p2p.bussness.service.IExpAccountGrantRecordService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service@Transactional
public class ExpAccountGrantRecordServiceImpl implements IExpAccountGrantRecordService {

    @Autowired
    private ExpAccountGrantRecordMapper expAccountGrantRecordMapper;

    @Override
    public int save(ExpAccountGrantRecord expAccountGrantRecord) {
        return expAccountGrantRecordMapper.insert(expAccountGrantRecord);
    }

    @Override
    public int update(ExpAccountGrantRecord expAccountGrantRecord) {
        return expAccountGrantRecordMapper.updateByPrimaryKey(expAccountGrantRecord);
    }

    @Override
    public ExpAccountGrantRecord get(Long id) {
        return expAccountGrantRecordMapper.selectByPrimaryKey(id);
    }

    @Override
    public PageInfo queryPage(QueryObject qo) {
        PageHelper.startPage(qo.getPageNum(),qo.getPageSize());
        List<ExpAccountGrantRecord> list = expAccountGrantRecordMapper.selectList(qo);
        return new PageInfo(list);
    }
}
